import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { environment } from '@env/environment';
import { LayoutSimpleComponent } from '@layout/simple/simple.component';
import { QuicklinkStrategy } from 'ngx-quicklink';

const routes: Routes = [
  { path: 'welcome', component: LayoutSimpleComponent, loadChildren: () => import('./welcome/welcome.module').then(m => m.WelcomeModule) },
  { path: 'base', loadChildren: () => import('./base/base.module').then(m => m.BaseModule) },
  { path: 'eis', loadChildren: () => import('./eis/eis.module').then(m => m.EisModule) },
  { path: '', redirectTo: 'welcome', pathMatch: 'full' },
  { path: '**', redirectTo: 'base/exception/404' }
];

@NgModule({
  providers: [QuicklinkStrategy],
  imports: [
    RouterModule.forRoot(routes, {
      useHash: environment.useHash,
      scrollPositionRestoration: 'top',
      preloadingStrategy: QuicklinkStrategy
    })
  ],
  exports: [RouterModule]
})
export class PageRoutingModule {}
